Skip to content

fix(ci): Fix failing CI dependencies due to Werkzeug and pytest_django#1124

Merged
ahmedetefy merged 14 commits into
masterfrom
ahmed-fix-failing-ci-trytond
Jun 1, 2021
Merged

fix(ci): Fix failing CI dependencies due to Werkzeug and pytest_django#1124
ahmedetefy merged 14 commits into
masterfrom
ahmed-fix-failing-ci-trytond

Conversation

@ahmedetefy

@ahmedetefy ahmedetefy commented May 31, 2021

Copy link
Copy Markdown
Contributor

This PR fixes failing CI due to :

  • trytond failing dependency because it uses deprecated methods in Wekzeug and so pinning werkzeug to version <2.0
  • Introduction of explicit database access requirement due to an experimental feature in pytest-django version 4.3

@ahmedetefy
ahmedetefy marked this pull request as draft May 31, 2021 08:55
@ahmedetefy ahmedetefy changed the title fix(ci): Pin trytond werkzeug dependency to Werkzeug<2.0 fix(ci): Fix failing CI dependencies due to Werkzeug and pytest_django Jun 1, 2021
@ahmedetefy
ahmedetefy marked this pull request as ready for review June 1, 2021 17:19

@untitaker untitaker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works for me

Comment on lines +27 to +36
pytest_mark_django_db_decorator = pytest.mark.django_db
try:
pytest_version = tuple(map(int, pytest_django.__version__.split(".")))
if pytest_version > (4, 2, 0):
pytest_mark_django_db_decorator = pytest.mark.django_db(databases="__all__")
except ValueError:
if "dev" in pytest_django.__version__:
pytest_mark_django_db_decorator = pytest.mark.django_db(databases="__all__")
except AttributeError:
pass

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is simpler:

Suggested change
pytest_mark_django_db_decorator = pytest.mark.django_db
try:
pytest_version = tuple(map(int, pytest_django.__version__.split(".")))
if pytest_version > (4, 2, 0):
pytest_mark_django_db_decorator = pytest.mark.django_db(databases="__all__")
except ValueError:
if "dev" in pytest_django.__version__:
pytest_mark_django_db_decorator = pytest.mark.django_db(databases="__all__")
except AttributeError:
pass
pytest_mark_django_db_decorator = pytest.mark.django_db(databases="__all__")
try:
pytest_version = tuple(map(int, pytest_django.__version__.split(".")))
if pytest_version <= (4, 2, 0):
pytest_mark_django_db_decorator = pytest.mark.django_db
except (ValueError, AttributeError):
pass

you'd have to test if this works though

@ahmedetefy ahmedetefy Jun 1, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah that would not work because pytest_django.__version__ was introduced in 4.0 I think, which means it will default to pytest.mark.django_db(databases="__all__") which isn't great because that will fail the tests for pytest_django versions <4.3

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahmedetefy
ahmedetefy merged commit b9c5cd4 into master Jun 1, 2021
@ahmedetefy
ahmedetefy deleted the ahmed-fix-failing-ci-trytond branch June 1, 2021 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants